const express = require('express')
const app = express()
const port = 3000
const path = require('path')

const mainRouter = require('./routers/index')
const userRouter = require('./routers/user')

app.use(mainRouter)
app.use(userRouter)

// 路由参数
app.get('/user/:userId/books/:bookId', (req, res) => {
  res.send(req.params)
})
app.get('/flights/:form-:to', (req, res) => {
  res.send(req.params)
})

app.use('/static', express.static(path.join(__dirname, 'public')))

app.listen(port, () => {
  console.log(`express-service listening on port ${port}`)
})